home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
pas_0493.zip
/
FIXEDM.ASM
< prev
next >
Wrap
Assembly Source File
|
1993-04-29
|
665b
|
26 lines
P386N
Dividend EQU dword ptr [bp+10]
Divisor EQU dword ptr [bp+6]
_TEXT SEGMENT BYTE USE16 PUBLIC 'CODE'
ASSUME cs:_TEXT
PUBLIC FixedDiv
PROC FixedDiv FAR
push bp
mov bp,sp
mov edx,Dividend
sub eax,eax
shrd eax,edx,16 ; position so that result ends up
sar edx,16 ; in EAX
idiv Divisor
shld edx,eax,16 ; whole part of result in DX
; fractional part is already in AX
pop bp
ret
ENDP FixedDiv
_TEXT ENDS
END